﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace WebApplication1
{
    public class DbHelper
    {
        private static readonly string conString = "server=.;database=CMS;uid=sa;pwd=123456";
        public static DataTable GetDataTable(string sql)
        {
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sql,conString );
            DataTable dataTable = new DataTable();
            sqlDataAdapter.Fill(dataTable);
            return dataTable;
        }
        public static int ACD(string sql)
        {
            SqlConnection sqlConnection = new SqlConnection(conString);
            SqlCommand sqlCommand = new SqlCommand(sql,sqlConnection);
            sqlConnection.Open();
            var res = sqlCommand.ExecuteNonQuery();
            sqlConnection.Close();
            return res;
        }
    }
}